package com.itheima.student;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
@WebServlet("/stuShowStu")
public class stuShowStu extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        BufferedReader br=new BufferedReader(new FileReader("d:\\score.txt"));
        resp.setContentType("text/html;charset=UTF-8");
        String line;
        while ((line=br.readLine())!=null){
            resp.getWriter().write(line);
            resp.getWriter().write("<br>");
        }
        br.close();
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
